/*
 *    Copyright 2022 CManLH
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.lifeonwalden.ms.caller.http.bean;


import org.apache.hc.core5.http.NameValuePair;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>Title: MultipartParam</p>
 * <p>Description:带文件的请求参数实体类</p>
 *
 * @version V1.0
 * @auther wbluyanhuan
 * @since 2020/5/11 11:15
 */
public class MultipartParam implements Serializable {
    private static final long serialVersionUID = -2378186293362785814L;

    private List<FileParam> files;
    private List<NameValuePair> params;

    public MultipartParam() {
        this.files = new ArrayList<>();
        this.params = new ArrayList<>();
    }

    public MultipartParam(List<FileParam> files, List<NameValuePair> params) {
        this.files = (null == files) ? new ArrayList<>() : files;
        this.params = (null == params) ? new ArrayList<>() : params;
    }

    public MultipartParam addFile(FileParam nameFilePair) {
        this.files.add(nameFilePair);
        return this;
    }

    public MultipartParam addParam(NameValuePair nameValuePair) {
        this.params.add(nameValuePair);
        return this;
    }

    public List<FileParam> getFiles() {
        return files;
    }

    public List<NameValuePair> getParams() {
        return params;
    }
}
